package com.itheima.sky.dao;

import com.itheima.sky.pojo.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;

/**
 * @Description UserMapper
 * @Author jiangning
 * @Date 2024-06-28
 */
@Mapper
public interface UserMapper {
    @Select("select id from user where phone = #{phone}")
    Long findUserIdByPhone(String phone);

    @Insert("insert into user(name,phone,sex,id_number,avatar,status) VALUES (#{id},#{phone},#{sex},#{idNumber},#{avatar},#{status})")
    @Options(useGeneratedKeys = true, keyProperty = "id")
    void insertUser(User user);
}
